/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "region_code")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RegionCode.findAll", query = "SELECT r FROM RegionCode r"),
    @NamedQuery(name = "RegionCode.findById", query = "SELECT r FROM RegionCode r WHERE r.id = :id"),
    @NamedQuery(name = "RegionCode.findByName", query = "SELECT r FROM RegionCode r WHERE r.name = :name"),
    @NamedQuery(name = "RegionCode.findByPinyin", query = "SELECT r FROM RegionCode r WHERE r.pinyin = :pinyin"),
    @NamedQuery(name = "RegionCode.findByCode", query = "SELECT r FROM RegionCode r WHERE r.code = :code"),
    @NamedQuery(name = "RegionCode.findByZipCode", query = "SELECT r FROM RegionCode r WHERE r.zipCode = :zipCode")})
public class RegionCode implements Serializable {
    @Size(max = 50)
    @Column(name = "coord_x")
    private String coordX;
    @Size(max = 50)
    @Column(name = "coord_y")
    private String coordY;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "id")
    private String id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "name")
    private String name;
    @Size(max = 5)
    @Column(name = "pinyin")
    private String pinyin;
    @Size(max = 10)
    @Column(name = "code")
    private String code;
    @Size(max = 10)
    @Column(name = "zip_code")
    private String zipCode;

    public RegionCode() {
    }

    public RegionCode(String id) {
        this.id = id;
    }

    public RegionCode(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPinyin() {
        return pinyin;
    }

    public void setPinyin(String pinyin) {
        this.pinyin = pinyin;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RegionCode)) {
            return false;
        }
        RegionCode other = (RegionCode) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.RegionCode[ id=" + id + " ]";
    }

    public String getCoordX() {
        return coordX;
    }

    public void setCoordX(String coordX) {
        this.coordX = coordX;
    }

    public String getCoordY() {
        return coordY;
    }

    public void setCoordY(String coordY) {
        this.coordY = coordY;
    }
    
}
